package com.treasure.mall.biz.entity.embeddable;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * 收货信息
 *
 * @author allan
 * @date 2018-01-15
 */
@Setter
@Getter
@Embeddable
public class ReceivingInfo {
    /**
     * 收货人
     */
    @Column(name = "receiver")
    private String userName;
    /**
     * 收货人手机
     */
    @Column(name = "receiver_mobile")
    private String telNumber;
    /**
     * 省
     */
    @Column(name = "province")
    private String provinceName;
    /**
     * 省代码
     */
    @Column(name = "province_code")
    private String provinceCode;
    /**
     * 市
     */
    @Column(name = "city")
    private String cityName;
    /**
     * 市代码
     */
    @Column(name = "city_code")
    private String cityCode;
    /**
     * 区
     */
    @Column(name = "district")
    private String countyName;
    /**
     * 区代码
     */
    @Column(name = "district_code")
    private String districtCode;
    /**
     * 详细地址
     */
    @Column(name = "address")
    private String detailInfo;
    /**
     * 收货地址国家码
     */
    @Column(name = "national_code")
    private String nationalCode;
    /**
     * 邮编
     */
    @Column(name = "zip")
    private String postalCode;

    public String fullAddress() {
        return provinceName + cityName + countyName + detailInfo;
    }

    public String fullAddressV2() {
        return provinceName + " " + cityName + " " + countyName;
    }

    public String byDot() {
        return provinceName + "," + cityName + "," + countyName;
    }

    public String codeByDot() {
        return provinceCode + "," + cityCode + "," + districtCode;
    }


    public String toName() {
        return userName + " " + telNumber;
    }
}
